﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace md.imi.membrane.common
{
    public class Logger
    {
        private static Logger _instance = null;
        public static Logger Instance
        {
            get
            {
                if (_instance == null)
                    _instance =  new Logger();

                return _instance;
            }
        }


        public void Info (String format, params  object [] arguments)
        {
            String message = String.Format(format, arguments);
            Debug.WriteLine(String.Format("{0} Info [{1}] : {2} ", DateTime.Now, Process.GetCurrentProcess().Id, message));    
        }

        public void Warning(String format, params  object[] arguments)
        {
            String message = String.Format(format, arguments);
            Debug.WriteLine(String.Format("{0} Warning [{1}] : {2} ", DateTime.Now, Process.GetCurrentProcess().Id, message));
        }

        public void Error(String format, params  object[] arguments)
        {
            String message = String.Format(format, arguments);
            Debug.WriteLine(String.Format("{0} Error [{1}] : {2} ", DateTime.Now, Process.GetCurrentProcess().Id, message));
        }

        public void Error(Exception ex)
        {
            Debug.WriteLine(String.Format("{0} Error [{1}] : {2} ", DateTime.Now, Process.GetCurrentProcess().Id, ex.Message));
        }


        public void Error(String message, Exception ex)
        {
            String messageString = String.Format("{0} {1}", message, ex.Message);
            Debug.WriteLine(String.Format("{0} Error [{1}] : {2} ", DateTime.Now, Process.GetCurrentProcess().Id, messageString));
        }
    }
}
